﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000116672851";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjMYYyjnrF1rnOGynfjmfS4BtArpVqh9ShlfMzMe++rbE5Zxn/4nQXT0elj/855kk80mKdai0UxqWNPmNLn2K+U0igVyfogJCvRx9GuuzlQ9Q/Ftd1QSs2TebBnZPkqEg91KQOndd4ckdu0FHEBUK6JAm1l+9mejz31EuD00y6j5qoryGhp5BoxOU2DQxll7mz0brd8vi0439Qd9GeGNV19+0ponUHUmeOj1lMPFPGURShVHLfrwYRzBmVs8aBtdrkFWS3jZnVjd59bY+2BTkGabzKdBN/pSFAgXGdYhxaaYrJoTycyk7z11lke6wGeUbVbSYzjNbgVIsucQtWzLTpAgMBAAECggEAQrRnihq7DErsv9ZSk1J+FbAM869o25aRz0qfkfmDaYlNu4ztD67cjPqW6pGlXWFH5liIfpd7vdZErSsnIy4PCoS4VvHJGjwS59JGcn7NfhjvlKodf4wXwaat/84NOZWfkcZtGJxkCpOLpzv3cAxGbhd08IkeDeFBMnvQMh4YatjIGzdAeKjLtjiNmSVjfGT6LJz6bEbKUWKg0CmA2E5h1ZKEwsL/rIifEwe89SsnH5btCm0uIH6kHeLDF+ZHy9haDpRsTwihImtq6LgvEKXgmp1ytfRr/hSvar+wwRXujMXoRgl9w4jP7xy0iN3YJGoLUbDBAiKVLraq6Dg/cBUcAQKBgQDhHC/YrSXU5MItfAFZzedTVagufv/5AmAaxbSFmJIXSsjmerqofTZMSe5fTtoapZfQENfqO7b3wI1ngigiMf+KfixCKX7DwuT3c7KXKxanBMkdImXiG8cMQ5YiosYb26jsQ4yBjn0saE8z0vUs443DuawxXWJsfPnp3gmw4OeACQKBgQC5lkoJ/2ObVrXO/Xx1YCRkNkMrQ8JGJXMzvSkystnJow6qICvuy2WoP8kTZsWbr8jIFl8El3YyNORR38Y1A9T9zUASWi0cEuwNkY5mvZKMWB0JbwfKYpl9dxkldUBNEwboL5jD8+aUWEO5t7qNB3Pnwpweb+ozyfRIkFNnEm0F4QKBgBuBnjcTsTO6YB++r0uR5VpBdTN5QT3kFGoxDkXkxrUh5jqDdJtx8ViREBeFQxFOeqZp6Hguo8TSOnUTamQDR/5cPHw5Jcw13FSARqpCEZqG8ywkL97ZFhFhkM7apOpyhMmZ12ldR95NQKBMfrjldUUdQvUlPAmVm9P/1Z9PW/pBAoGAYQxdVVMO5Gl4k3BtB/gpr5nMkDBTxFjLIHA3vgJW7yFshrxiHPKSC2SnopSom1xWE4PXVlBaB7EvAD2TqZ+CXuJZMf+j/T1L4WCPZdyWaPue25MLMONUvo5sQPFKmcNsZjiVm0rM9iAd8l1ImX0fOD/FYglGIKToMJYAdzLkfiECgYEA2FtTQUKR4FhJnhcsvcIQstbxRgVgLzY63S3dJrMfX2qMqF1VNONAU6APi5NLj5Ua1W369ZDwl8JyulgY4F/fjlYhkgBJFl532ZUAvVBKRs4lIlLsV3bd4d3SlZ9HAC1/jRH/yoPoXeI01CMA3g+IcWjrnBA8y2CEueBpgYHltmU=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn7lwQfB6gHJIR2jrbgGMPW5m9ugGaI0gj2iq1kI8+4hknSfcv02NYxecbnQolDUKTWxXq5zaOouqIE8t/3iF6+11nZabSBLQ/CIlioDWgWQkacxgzPowfWGXuD9xQWcku3llt8mZ9C3a9VOB0L2asB+qveEt/qtXWUBYqklDchKykS9PvYvX1TZRJBI1BrE1ZvRIgaNassEXZqCjdsxvBt2RMxnwx0X0dMHu1R9ZoyE3pZnqZD00ZURPVCo/5knlP3HZcECkeOj9Smq53ZJrZcs3LRJd1Ceb2jCC5xet3c9wTm2gH8SMFuRqc9lRHVYCQhCsAg3uSxFoZH5DuaUsRwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
public static String notify_url = "http://www.baidu.com";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
	public static String return_url = "http://www.4399.com";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

